$(function(){
	
	
	$("input:text").click(function(){
		if( $(this).val()!="username" & $(this).val()!="Full Name" & $(this).val()!="Your e-mail address" ) {
		} else {
			$(this).val("");
			$(this).css({'color':'#000000'});
		}
	});
	
	$("input#mailaddress_moving").click(function(){
		if( $("input#welcome_mailaddress").val().indexOf("@",0) == -1 ) {
			$("input#welcome_mailaddress").css({'background-color':'#ffacba', 'color':'#e73d59', 'border-color':'#e73d59'});
		} else {
			var userMailAddress = $("input#welcome_mailaddress").val();
			$("input#form_mailaddress").attr("value", userMailAddress);
			$("#welcome_div").fadeOut(250, function(){
				$("#username_div").fadeIn(250);
			});
		}
	});
	
	$("input#welcome_mailaddress").click(function(){
		$(this).css({'background-color':'#ffffff', 'color':'#000000', 'border-color':'#e3e3e3'});
	});
	
	$('#bottom_buttons .support_us').click(function (e) {
		$('#support_us').modal();

		return false;
	});
	
	$('#bottom_buttons .contact').click(function (e) {
		$('#contact').modal();

		return false;
	});
	
	$('.closebutton').click(function (e) {
		$("#welcome_mailaddress").val('');
		$("#username_div").fadeOut(250, function(){
			$("#welcome_div").fadeIn(250);
		});
		$("#username_msg").hide();
		$(".username_box").show('slow');
	});
	
	$('#submit').click(function (e) {
	var data = $("#reserve_form").serialize();
		$.ajax({  
			type: "POST",  
			url: "send.php",  
			data: data ,  
			success: function(msg) {
				$(".username_box").fadeOut('slow', function(){
					$("#username_msg").html(msg);
					$("#username_msg").fadeIn('slow');
				});
			}  
		});

		return false;
	});
	
	$('#submit_message').click(function (e) {
		if( $('#contact_mailaddress').val() != 'mail@address.com' & $('#contact_name').val() != 'Full Name' & $('#contact_message').val() != 'Your messages' ){
			$.ajax({
				type: "POST",  
				url: "message.php",  
				data: $("#message_form").serialize(),  
				success: function(msg) {  
					$("#contact").html(msg); 
				}
			});
			
			return false;
		}
	});
	
});